package com.second.app.thread.change;

/**
 * @Author soul gao
 * @Date 2021/1/24 16:11
 * 努力学习 天天进步
 */
public class Main {

    public static void main(String[] args) {
        final String lock = new String("");


        new Thread(() -> {
            Subtract subtract = new Subtract(lock);
            subtract.subtract();
        }, "subtract线程1").start();

        new Thread(() -> {
            Subtract subtract = new Subtract(lock);
            subtract.subtract();
        }, "subtract线程2").start();

        try {
            Thread.sleep(1000);
            System.out.println("主线程执行：" + System.currentTimeMillis());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        new Thread(() -> {
            Add add = new Add(lock);
            add.add();
        }, "add线程").start();
    }


}
